#include "sinner.h"

sinner::sinner(AnimationManager &a,Level &lev,int x,int y): miscellanea(a,x,y){
    option("sinner", 0.01, 15, "move");
    hit = false;
    joke = false;
    st = false;
}

void sinner::update(float time){
    if (life){
        anim.set("move");
    }
    if(dx < 0 && life){
        dir = true;
    }
    else dir = false;
    x += dx*time;
    timer += time;
    if (timer > 3200) {
        dx *= -1;
        timer = 0;
    }

    if (Health <= 0) {
        anim.set("fulldead"); 
        dx=0;
        timer_end += time;
        if (timer_end > 4000) life = false;
    }
    if (joke) anim.set("dobrogoose");
    if (hit) anim.set("fulldead");
    if (dir) anim.flip();
    anim.tick(time, st);
}